package com.hsh.maoduo.controller;

import com.hsh.maoduo.common.Result;
import com.hsh.maoduo.pojo.dto.ShopGoodsDTO;
import com.hsh.maoduo.pojo.vo.ShopGoodsVO;
import com.hsh.maoduo.service.ShopGoodsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/shopGoods")
public class ShopGoodsController {
    @Resource
    private ShopGoodsService shopGoodsService;

    /**
     * 列表查询
     *
     * @param shopGoodsVO
     * @return
     */
    @GetMapping("/list")
    public List<ShopGoodsDTO> getList(ShopGoodsVO shopGoodsVO) {
        return shopGoodsService.getList(shopGoodsVO);
    }

    /**
     * 列表查询
     *
     * @param shopGoodsVOList
     * @return
     */
    @PostMapping("/addList")
    public Result<Integer> addList(@RequestBody List<ShopGoodsVO> shopGoodsVOList) {
        return shopGoodsService.addList(shopGoodsVOList);
    }

    @PostMapping("update")
    public Result<Integer> update(ShopGoodsVO shopGoodsVO) {
        return shopGoodsService.update(shopGoodsVO);
    }

    @PostMapping("/delete")
    public Result<Integer> delete(Integer id){
        return shopGoodsService.delete(id);
    }
}
